<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('添加通用岗位')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<style>
    input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }

    input[type="number"] {
        -moz-appearance: textfield;
    }
</style>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content" id="dv">
    <form class="form-horizontal m" id="form-job-add" AUTOCOMPLETE="OFF">
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">通用岗位名称：</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" id="jobName" name="jobName"
                               placeholder="通用岗位名称" required/>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4 control-label">考核数据上传：</label>
                    <div class="col-sm-8">
                        <input type="file" id="file1" name="file"/>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>

<script type="text/javascript">
    var prefix = ctx + 'acvJobManage';

    $(function () {

    })

    function submitHandler() {
        if ($.validate.form()) {
            var file = $('#file1')[0].files[0];
            if (file === undefined) {
                $.modal.alertWarning("请选择通用考核数据");
                return false;
            }
             var formData = new FormData();
             formData.append("file", file);
             formData.append("jobName", $("#jobName").val());
            $.ajax({
                url: prefix + '/addJob',
                data: formData,
                type: "post",
                processData: false,
                contentType: false,
                success: function(result) {
                    $.operate.saveSuccess(result);
                }
            })
        }

        console.log(file);
        // var formData = new FormData();
        // formData.append("file", $('#' + fileId)[0].files[0]);
        // formData.append("updateSupport", $("input[name='updateSupport']").is(':checked'));
    }

</script>
</body>
</html>